<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" >
        <title>绑定支付宝</title>
        <link rel="stylesheet" href="../vender/css/normalize.css">
        <link rel="stylesheet" href="prise.css">
    </head>
    <body>
        <header>
            <img src="../public_img/return.png"  alt="返回"
onclick="history.back(-1)">
            <p>绑定支付宝</p>
        </header>
        <section>
            <ul class="pay_zhifu">
                <li>
                    <span>姓名:</span>
                    <input class="name" type="text">
                </li>

                <li>
                    <span>支付宝账户:</span>
                    <input class="account" type="text">
                </li>

            </ul>
        </section>
         <div style="width:100% ; text-align: center">
                <button class='return' style="padding: 0.06rem 1rem;border-radius: 2rem;font-size: 0.2rem;background-color:  #FC9E16;color: #fff;border: none"> 确认</button>
            </div>
        <script src="../info/jquery.min.js"></script>
        <script src="../layer.js"></script>
        <script>
            $(".return").click(function(){
                var name = $(".name").val();
                if(name==''){
                    layer.msg('请输入姓名');
                    return false;
                }
                var account=$('.account').val();
                if(account==''){
                    layer.msg('请输入账号');
                }
                var token = localStorage.phone;
                $.ajax({
                    url:'https://newapp.icandrive.cn/api/bind_account.php',
                    dataType:'json',
                    data:{token:token,name:name,account:account},
                    type:'post',
                    success:function(data){
                        if(data.status==250){
                            layer.msg("请重新登录");
                            setInterval(function(){
                                window.location.href="../login/log_in.html";
                            },2000);
                        }
                        if(data.status==200){
                            layer.msg('修改成功',function(){
                                  localStorage.alipay=account;
                                history.back();
                            },1000)

                        }
                        if(data.status==400){
                            layer.msg('操作失败');
                        }
                    },
                    error:function(){
                        layer.msg("服务器繁忙");
                    }
                });
            });
        </script>

        <script>
    document.addEventListener("plusready", function() {
        // 注册返回按键事件
        plus.key.addEventListener('backbutton', function() {
            window.history.back();
        }, false);
        //此处false代表不退出页面，如果为true回退到上一个一面
    });
</script>
    </body>
</html>
